package com.hlk.exception;

import com.hlk.enums.ResponseStatusEnum;
import com.hlk.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.multipart.MaxUploadSizeExceededException;

import java.sql.ResultSet;

/**
 * https://shikey.com/
 *
 * @author hlk
 * @version 1.0
 * @date 2020-12-17 14:14
 */
@RestControllerAdvice
public class HuaExceptionHandler {


    @ExceptionHandler(HuaException.class)
    public Result handleHuaException(HuaException ex) {
        ex.printStackTrace();
        return Result.exception(ex.getResponseStatusEnum());
    }

    @ExceptionHandler(MaxUploadSizeExceededException.class)
    public Result handleMaxUploadSizeExceededException(MaxUploadSizeExceededException ex) {
        ex.printStackTrace();
        return Result.exception(ResponseStatusEnum.FILE_MAX_SIZE_ERROR);
    }
}
